import React, { Component } from 'react';
import { connect } from 'react-redux';
import Videoitem from './videoItem';

class ShowVideo extends Component{
    render() { 
        let { deviceList, currentPage } = this.props;
        let showDeviceList = deviceList[currentPage - 1];
        return (
            <div className='show-video' >
               <div className = "show-video-title" > 监控列表： </div>
               <div className = "videos" >
                    <div className="video-list" >
                        {showDeviceList ? showDeviceList.map((item) => <Videoitem key={item.name} info={item}/>) : ''}
                    </div>
                </div>
            </div>
        );
    }
}

const mapStateToProps = (state) => {
    return {
        deviceList: state.deviceList,
        accessToken: state.accessToken,
        currentPage: state.currentPage,
    };
};
export default connect(mapStateToProps)(ShowVideo);